home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / source_gerc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-14  |  2.3 KB  |  64 lines

  1. /* blas/source_gerc.h
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. {
  21.   INDEX i, j;
  22.  
  23.   const BASE alpha_real = CONST_REAL0(alpha);
  24.   const BASE alpha_imag = CONST_IMAG0(alpha);
  25.  
  26.   if (order == CblasRowMajor) {
  27.     INDEX ix = OFFSET(M, incX);
  28.     for (i = 0; i < M; i++) {
  29.       const BASE X_real = CONST_REAL(X, ix);
  30.       const BASE X_imag = CONST_IMAG(X, ix);
  31.       const BASE tmp_real = alpha_real * X_real - alpha_imag * X_imag;
  32.       const BASE tmp_imag = alpha_imag * X_real + alpha_real * X_imag;
  33.       INDEX jy = OFFSET(N, incY);
  34.       for (j = 0; j < N; j++) {
  35.     const BASE Y_real = CONST_REAL(Y, jy);
  36.     const BASE Y_imag = -CONST_IMAG(Y, jy);
  37.     REAL(A, lda * i + j) += Y_real * tmp_real - Y_imag * tmp_imag;
  38.     IMAG(A, lda * i + j) += Y_imag * tmp_real + Y_real * tmp_imag;
  39.     jy += incY;
  40.       }
  41.       ix += incX;
  42.     }
  43.   } else if (order == CblasColMajor) {
  44.     INDEX jy = OFFSET(N, incY);
  45.     for (j = 0; j < N; j++) {
  46.       const BASE Y_real = CONST_REAL(Y, jy);
  47.       const BASE Y_imag = -CONST_IMAG(Y, jy);
  48.       const BASE tmp_real = alpha_real * Y_real - alpha_imag * Y_imag;
  49.       const BASE tmp_imag = alpha_imag * Y_real + alpha_real * Y_imag;
  50.       INDEX ix = OFFSET(M, incX);
  51.       for (i = 0; i < M; i++) {
  52.     const BASE X_real = CONST_REAL(X, ix);
  53.     const BASE X_imag = CONST_IMAG(X, ix);
  54.     REAL(A, i + lda * j) += X_real * tmp_real - X_imag * tmp_imag;
  55.     IMAG(A, i + lda * j) += X_imag * tmp_real + X_real * tmp_imag;
  56.     ix += incX;
  57.       }
  58.       jy += incY;
  59.     }
  60.   } else {
  61.     BLAS_ERROR("unrecognized operation");
  62.   }
  63. }
  64.